import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Home from '@/views/Home.vue';
import Index from '@/views/Index.vue';
import Login from '@/views/Login.vue';
import UserCenter from '../views/UserCenter.vue';
import Exhibitions from "../views/Exhibitions.vue";
import Camera from "../views/Camera.vue";
import About from "../views/About.vue";
import Visit from "../views/Visit.vue";
import ExhibitDetails from "../views/ExhibitDetails.vue";

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Index',
        component: Index,
    },
    {
        path: '/users/login',
        name: 'Login',
        component: Login,
    },
    {
        path: '/Home',
        name: 'Home',
        component: Home,
    },
    {
        path: '/Visit',
        name: 'Visit',
        component: Visit,
    },
    {
        path: '/UserCenter',
        name: 'UserCenter',
        component: UserCenter,
    },
    {
        path: '/Exhibitions',
        name: 'Exhibitions',
        component: Exhibitions,
    },
    {
        path: '/exhibitDetails/:id', // 定义文物详情页路由路径，使用动态路由参数 :id 来区分不同文物的详情页
        name: 'ExhibitDetails',
        component: ExhibitDetails,
    },
    {
        path: '/Camera',
        name: 'Camera',
        component: Camera,
    },
    {
        path: '/About',
        name: 'About',
        component: About,
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 在这里添加路由的导航守卫
router.beforeEach((to, from, next) => {
    console.log('Navigating to:', to.path);
    next();
});

export default router;
